package com.zmn.oms.zmn.business.impl.config;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.google.common.collect.Lists;
import com.zmn.base.common.data.common.dro.tags.TagsDRO;
import com.zmn.base.common.data.common.query.tags.TagsQuery;
import com.zmn.base.common.data.dubbo.interfaces.tags.TagsListRemoteService;
import com.zmn.common.constant.GlobalConsts;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.common.utils.collection.CollectionUtil;
import com.zmn.common.utils.number.NumberUtil;
import com.zmn.common.utils.string.StringUtil;
import com.zmn.oms.common.constant.OrderConsts;
import com.zmn.oms.common.vo.KVDict;
import com.zmn.oms.zmn.business.interfaces.config.OrderConfigBService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 类描述：订单配置
 *
 * @author wangxiaokun
 * @since 2021/10/25 18:06
 */
@Service
public class OrderConfigBServiceImpl implements OrderConfigBService {

    @Reference(version = com.zmn.base.plat.engine.common.constant.DubboConsts.INTERFACE_VERSION , check = false)
    private TagsListRemoteService tagsListRemoteService;

    /**
     * 获取验收配置
     * @param orderId
     * @return
     */
    @Override
    public List<KVDict> getAcceptanceConfig(Long orderId) {

        List<KVDict> list = Lists.newLinkedList();

        /*list.add(KVDict.builder().value(1).text("服务完成后未对机器进行复原").build());
        list.add(KVDict.builder().value(2).text("维修后问题未得到解决").build());
        list.add(KVDict.builder().value(3).text("工程师虚假更换配件").build());
        list.add(KVDict.builder().value(4).text("工程师未按公司标准进行收费").build());*/

        TagsQuery tagsDIO = new TagsQuery();
        tagsDIO.setOneTypeId(OrderConsts.BASE_CODE_MAP_ONE_TYPE_ACCEPTANCE_EQCODE);
        tagsDIO.setStatus(GlobalConsts.YES);
        ResponseDTO<List<TagsDRO>> responseDTO = tagsListRemoteService.listByTagsDIO(tagsDIO);
        if (responseDTO.isSuccess() && CollectionUtil.isNotNullOrEmpty(responseDTO.getData())) {
            responseDTO.getData().forEach(dro -> {
                list.add(KVDict.builder().value(dro.getTagId()).text(dro.getName()).build());
            });
        }
        return list;
    }
}
